<?php

namespace app\topics\controller;

class DetailManageController extends \app\topics\controller\TopicsController {


    protected $_middle = 'topics/DetailManage';

    public function del() {
        target($this->_middle, 'middle')->setParams([
            'id' => request('', 'id'),
            'user_id' => $this->userInfo['user_id'],
            'manage_user' => $this->topicsConfig['manage_user']
        ])->del()->export(function ($data, $msg) {
            $this->success($msg);
        }, function ($message, $code, $url) {
            $this->errorCallback($message, $code, $url);
        });
    }

    public function top() {
        target($this->_middle, 'middle')->setParams([
            'id' => request('', 'id'),
            'user_id' => $this->userInfo['user_id'],
            'manage_user' => $this->topicsConfig['manage_user']
        ])->top()->export(function ($data, $msg) {
            $this->success($msg);
        }, function ($message, $code, $url) {
            $this->errorCallback($message, $code, $url);
        });
    }

    public function excellent() {
        target($this->_middle, 'middle')->setParams([
            'id' => request('', 'id'),
            'user_id' => $this->userInfo['user_id'],
            'manage_user' => $this->topicsConfig['manage_user']
        ])->excellent()->export(function ($data, $msg) {
            $this->success($msg);
        }, function ($message, $code, $url) {
            $this->errorCallback($message, $code, $url);
        });
    }

    public function reply() {
        target($this->_middle, 'middle')->setParams([
            'id' => request('', 'id'),
            'reply_id' => request('', 'reply_id'),
            'user_id' => $this->userInfo['user_id'],
            'manage_user' => $this->topicsConfig['manage_user']
        ])->reply()->export(function ($data, $msg) {
            $this->success($msg);
        }, function ($message, $code, $url) {
            $this->errorCallback($message, $code, $url);
        });
    }

}